import {lazy} from 'react'

//一级路由
var Index =lazy( ()=> import('../views/Index') )
var Login=lazy( ()=> import('../views/Login') )
var Register=lazy( ()=> import('../views/Register') )
var NotFound=lazy( ()=> import('../views/NotFound') )

//index下的二级路由
var Home = lazy ( ()=>import('../views/Index/Home') )
var CustomCenter = lazy ( ()=>import('../views/Index/CustomCenter') )
var ServiceCenter = lazy ( ()=>import('../views/Index/ServiceCenter') )
var StaffCenter = lazy ( ()=>import('../views/Index/StaffCenter') )
var SystemManage = lazy ( ()=>import('../views/Index/SystemManage') )

//CustomCenter下的三级路由
var CustomManage = lazy ( ()=>import('../views/Index/CustomCenter/CustomManage') )

//StaffCenter下的三级路由
var RoleManage = lazy ( ()=>import('../views/Index/StaffCenter/RoleManage') )
var StaffManage = lazy ( ()=>import('../views/Index/StaffCenter/StaffManage') )

//SystemManage下的三级路由
var Historydata = lazy ( ()=>import('../views/Index/SystemManage/Historydata') )
var Realtimedata = lazy ( ()=>import('../views/Index/SystemManage/Realtimedata') )



var routes = [
    {
        path:'/index',
        component:Index,
        permission_no:1,
        children:[
            {
                path:'/index/home',
                exact:true,
                component:Home,
                permission_no:11,
            },
            {
                path:'/index/customcenter',
                component:CustomCenter,
                permission_no:14,
                children:[
                    {
                        path:'/index/customcenter/custommanage',
                        exact:true,
                        component:CustomManage,
                        permission_no:141,
                    },
                    {
                        from:'/index/customcenter',
                        to:'/index/customcenter/custommanage',
                        exact: true,
                    },
                    {
                        component:NotFound,
                    },

                ]
            },
            {
                path:'/index/servicecenter',
                exact:true,
                component:ServiceCenter,
                permission_no:12,
            },
            {
                path:'/index/staffcenter',
                component:StaffCenter,
                permission_no:13,
                children:[
                    {
                        path:'/index/staffcenter/staffmanage',
                        exact:true,
                        component:StaffManage,
                        permission_no:131,
                    },
                    {
                        path:'/index/staffcenter/rolemanage',
                        exact:true,
                        component:RoleManage,
                        permission_no:132,
                    },
                    
                    {
                        from:'/index/staffcenter',
                        to:'/index/staffcenter/staffmanage',
                        exact: true,
                    },
                
                    {
                        component:NotFound,
                    },
                ]
            },
            {
                path:'/index/systemmanage',
                component:SystemManage,
                permission_no:15,
                children:[
                    {
                        path:'/index/systemmanage/realtimedata',
                        exact:true,
                        component:Realtimedata, 
                        permission_no:151,
                        
                    },
                    {
                        path:'/index/systemmanage/historydata',
                        exact:true,
                        component:Historydata,
                        permission_no:152, 
                    },
                    {
                        from:'/index/systemmanage',
                        to:'/index/systemmanage/realtimedata',
                        exact: true,
                    },
                
                    {
                        
                        component:NotFound,
                    },
                ]
            },
            {
                from:'/index',
                
                to:'/index/home',
                exact: true,
            },
            {
                
                component:NotFound,
            },
        ]
    },
    {
        path:'/login',
        exact:true,
        component:Login,
        // permission_no:2,
    },
    {
        path:'/register',
        exact:true,
        component:Register,
    },
    {
        from:'/',
        to:'/index',
        exact: true,
    },
    {
        component:NotFound,
    },

]

export default routes